<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">

	/******切换页码 ********/
	function gotoSelectedPage(obj) {
		var pageNo = obj.value;
		gotoPage(pageNo);
	}

	/**切换每页显示条数 ***/
	function goToChangePage(){
		var pageSize =  document.getElementById("pageSizeSelect").value;
		var x = document.forms[0];
		document.getElementById("pageSize").value = pageSize;
		document.getElementById("curPage").value = 1;
		x.submit();
	}

	function gotoPage(pageNo) {
		var x = document.forms[0];
		document.getElementById("curPage").value = pageNo;
		var url = x.action;
		if(url.indexOf("?")>0){
			url += "&c_"+pageNo;
		}else{
			url += "?c_"+pageNo;
		}
		x.action = url;
		x.submit();
	}

	function goToHead(){
		gotoPage(1);
	}

	function goToNext(){
		var cur_No = document.getElementById("curPage").value;
		gotoPage(parseInt(cur_No)+1);
	}

	function goToPre(){
		var cur_No = document.getElementById("curPage").value;
		gotoPage(parseInt(cur_No)-1);
	}

	function goToLast(){
		var totalPages = document.getElementById("totalPages_Hidden").value;
		gotoPage(totalPages);
	}
	
</script>

	<input type="hidden" value="${page.pageCount }/>" name="totalPages_Hidden" id="totalPages_Hidden" />
	<input type="hidden" value="${page.pageNo }" name="curPage" id="curPage" />
	<input type="hidden" value="${page.pageSize }" name="pageSize" id="pageSize" /> 
	<c:choose>
		<c:when test="${page.pageNo > 1}"><a href="#" onclick="javascript:goToPre()">上一页</a></c:when>
		<c:otherwise>上一页</c:otherwise>
	</c:choose>
	每页
	<select name="pageSizeSelect" id="pageSizeSelect" onchange="goToChangePage()">
		<option value="10" <c:if test="${ page.pageSize == 10 }">selected</c:if>>10</option>
		<option value="20" <c:if test="${ page.pageSize == 20 }">selected</c:if>>20</option>
		<option value="50" <c:if test="${ page.pageSize == 50 }">selected</c:if>>50</option>
		<option value="100" <c:if test="${ page.pageSize == 100 }">selected</c:if>>100</option>
	</select>条 
	 <select name="pageNumberSelect" onchange="gotoSelectedPage(this);" id="pageNumberSelect">
		<c:forEach begin="1" end="${page.pageCount}" var="current">
  			<option value="${current}" <c:if test="${ page.pageNo == current }">selected</c:if> >第${current}页</option>
		</c:forEach>
	</select> 
	<c:choose>
		<c:when test="${page.pageNo < page.pageCount }"><a href="#" onclick="javascript:goToNext()">下一页</a></c:when>
		<c:otherwise>下一页</c:otherwise>
	</c:choose>

	
